package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.ViolationRecordPageQueryDTO;
import com.sky.entity.ViolationRecord;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ViolationRecordMapper {
    Page<ViolationRecord> pageQuery(ViolationRecordPageQueryDTO pageQuery);

    @Select("select * from violation_record where id = #{id}")
    ViolationRecord getById(Long id);

    Page<ViolationRecord> mypageQuery(ViolationRecordPageQueryDTO pageQuery);

    //批量删除
    void deleteBatch(List<Long> ids);

    //统计
    List<Map<String, Object>> sumByMap(Map<String, Object> map);

    //查找违法等级
    @Select("select level from warning where violation = (select id from violation where type=#{violationType})")
    Integer findWarningLevel(String violationType);

    //统计违法记录
    Double totalByMap(Map map);
    //饼图
    Double totalOverSpeed(Map map);
    Double totalRunRed(Map map);
    Double totalCarRunRed(Map map);
    Double totalTouchLine(Map map);
    Double totalTurnWrong(Map map);

    Double getMytotal(Long currentId);

}
